package cn.tedu.lucky.draw.server.controller;

import cn.tedu.lucky.draw.server.common.result.JsonResult;
import cn.tedu.lucky.draw.server.protocol.po.Rule;
import cn.tedu.lucky.draw.server.service.IActivityRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class ActivityRuleController {

    @Autowired
    private IActivityRuleService activityRuleService;

    @GetMapping("/draw/activity-rule/findRule/{id}")
    public JsonResult<List<Rule>> findRuleByActivityId(@PathVariable Long id){
        return JsonResult.ok(activityRuleService.findRuleByActivityId(id));
    }

}
